package org.springblade.modules.repair.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.common.cache.DictCache;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.repair.vo.plan.wx.PlanMaintainUserVO;

import java.util.Date;
import java.util.List;

@Data
public class PlanAbarbeitungDetailVO {

    /**
     * 工单id
	 */
	private Long planId;

	/**
     * 电梯id
	 */
	private Long elevatorId;

    /**
     * 工单状态
	 */
	private Integer planStatus;

	/**
	 * 计划执行时间
	 */
	private Date planDate;

	/**
	 * 计划截止时间
	 */
	private Date planFinishDate;

	/**
	 * 计划逾期状态 1-未逾期 2-即将逾期 3-已逾期
	 */
	private Integer overdueType;

    /**
     * 紧急程度
	 */
	private Integer emerProcType;

	/**
	 * 计划逾期状态名称
	 */
	private String overdueTypeName;

    /**
     * 转派次数
	 */
	private Integer redeployCount;

	/**
	 * 转派截止时间
	 */
	private Date redeployFinishDate;

	/**
	 * 转派逾期状态 1-未逾期 2-即将逾期 3-已逾期
	 */
	private Integer redeployOverdueStatus;

	/**
	 * 转派逾期状态名称
	 */
	private String redeployOverdueStatusName;

	/**
     * 来源工单历史记录
	 */
	private List<PlanAbarbeitungByContentVO> fromHistoryList;

    /**
     * 整改项记录
	 */
	private List<PlanAbarbeitungByContentVO> afterHistoryList;

	@ApiModelProperty("维保人员信息")
	private List<PlanMaintainUserVO> maintainUserList;

	@ApiModelProperty("任务追踪记录")
	private WorkTrackVO workTrack;

    /**
     * 项目名称
	 */
	private String buildingName;

	/**
	 * 项目类型
	 */
	private String buildingType;

	/**
	 * 项目类型
	 */
	private String buildingTypeName;

	/**
	 * 项目地址
	 */
	private String buildingAddress;

	/**
	 * 电梯运行状态
	 */
	private Integer isStop;

	/**
	 * 电梯地址
	 */
	private String elevatorAddress;

	/**
	 * 电梯编码
	 */
	private String registerNumber;

	/**
	 * 品牌名称
	 */
	private String brandName;

	/**
	 * 电梯类型
	 */
	private String modeName;

	/**
	 * 物业联系人
	 */
	private String contactsName;

	/**
	 * 物业电话
	 */
	private String phone;

	@ApiModelProperty(value = "最后一次任务")
	private LastPlanVO lastPlan;

	public void setBuildingType(String buildingType) {
		if(Func.isNotEmpty(buildingType)){
			this.buildingTypeName = DictCache.getValue("building_type",buildingType);
		}
		this.buildingType = buildingType;
	}

	public void setOverdueType(Integer overdueType) {
		if(Func.isNotEmpty(overdueType)){
			if(overdueType.equals(1)){
				this.overdueTypeName = "未逾期";
			}else if (overdueType.equals(2)){
				this.overdueTypeName = "即将逾期";
			}else {
				this.overdueTypeName = "已逾期";
			}
		}
		this.overdueType = overdueType;
	}

	public void setRedeployOverdueStatus(Integer redeployOverdueStatus) {
		if(Func.isNotEmpty(redeployOverdueStatus)){
			if(redeployOverdueStatus.equals(1)){
				this.redeployOverdueStatusName = "未逾期";
			}else if (redeployOverdueStatus.equals(2)){
				this.redeployOverdueStatusName = "即将逾期";
			}else {
				this.redeployOverdueStatusName = "已逾期";
			}
		}
		this.redeployOverdueStatus = redeployOverdueStatus;
	}

}
